/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package skelbkim;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;

/**
 *
 * @author laimis
 */
public class Skelbiu24 extends SeleneseTestCase {

    public void setUp() throws Exception {
        setUp("http://www.skelbiu24.lt/", "*firefox");
    }

    public void newNotation(String noticeText, String phone, String name, String noticeTitle, String email) throws Exception {
        selenium.open("/skelbti.php");
        if (isPageLoude()) {
            selenium.select("category", "label=Įvairūs");
            selenium.click("//option[@value='12']");
            selenium.select("subcategory", "label=WWW svetainės");

            selenium.type("antr", noticeTitle);
            selenium.type("skelb", noticeText);
            selenium.select("miestas", "label=Klaipėda");
            selenium.type("tel", phone);
            selenium.type("email", email);
        }
    }

    private boolean isPageLoude() {
        boolean result = true;
        while (!selenium.isElementPresent("//*[@id='subcategory']")) {
            selenium.waitForPageToLoad("5000");
        }
        return result;
    }
}
